

import React, { useState } from 'react';
import { Button, Input, Modal,message} from 'antd';
import axios from 'axios';
import  baseaxiso from '../../../../../src/axios/config'
export default function Ed ({id}:{id:number}){
   const [a,seta]=useState(false)
   const [b,setb]=useState("")
   const [c1,setc]=useState("")
   const a2 =()=>{
    seta(false)
   }
   const c = (e:any)=>{
    setb(e.target.value)
    console.log(e.tar.get.value)
   }
    const acb =()=>{
seta(true)
    }
    const abc = (e: any) => {
        setb(e.target.value);
        console.log(e.target.value);
      };
      const abc1 = (e: any) => {
        setc(e.target.value);
        console.log(e.target.value);
      };
      const onFinish = () => {
        
    console.log(id)
    console.log(b)
      
    baseaxiso.post("/schg/edit", {
            "id":id,
           "name":b,
           "cloud":c1
        }).then(res=>{
           seta(false)
           message.info("修改成功")
           
      
    })
      };
    
  
    
   

return (
    <>
<Button  type="primary" onClick={acb}>编辑</Button>
      <Modal title="请输入你要修改的的内容"  open={a}  onOk={onFinish} onCancel={a2}  >
     名字: <Input value={b} onChange={abc} style={{ width: 150 }}></Input><br></br>
     云服务器ip地址: <Input value={c1} onChange={abc1} style={{ width: 150 }}></Input>
      </Modal>
    
      </>
)
}


